<template>
  <div class="nsw-container">
    <div class="time-line">
      <div class="start">
        <div class="date date1">
          {{ parseTime(time1, "{y}-{m}-{d}") }}
        </div>
        <div class="date">
          {{ parseTime(time2, "{y}-{m}-{d}") }}
        </div>
        <div class="date date3">
          {{ parseTime(time3, "{y}-{m}-{d}") }}
        </div>
      </div>
      <div class="middle">
        <div class="circle-box">
          <div class="circle"></div>
        </div>
        <div class="line"></div>
        <div class="circle-box">
          <div class="circle"></div>
        </div>
        <div class="line"></div>
        <div class="circle-box">
          <div class="circle"></div>
        </div>
      </div>
      <div class="line"></div>
      <div class="end">
        <div class="text text1">{{taskStatus1}}</div>
        <div class="text">{{taskStatus2}}</div>
        <div class="text text3">{{taskStatus3}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "TaskLine",
  props: ["publishDate", "recruitmentEndDate", "taskEndDate", "status"],
  data() {
    return {
      time1: "",
      time2: "",
      time3: "",
      taskStatus1: "",
      taskStatus2: "",
      taskStatus3: "",
    };
  },
  created() {
    if (this.status == 0 || this.status == 1) {
      this.taskStatus1 = '招募开始'
      this.taskStatus2 = '招募结束'
      this.taskStatus3 = '任务结束'
      this.time1 = this.publishDate
      this.time2 = this.recruitmentEndDate
      this.time3 = this.taskEndDate

    } else if (this.status == 2 || this.status == 3) {
      this.taskStatus1 = '任务开始'
      this.taskStatus2 = '正在设计'
      this.taskStatus3 = '任务结束'
      this.time1 = this.recruitmentEndDate
      this.time2 = null
      this.time3 = this.taskEndDate
    }
    
  }
};
</script>

<style scoped lang="scss">
.time-line {
  width: 580px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-direction: column;
  .start {
    width: 580px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .date {
      width: 120px;
      text-align: center;
    }
    .date1 {
      text-align: left;
    }
    .date3 {
      text-align: right;
    }
  }
  .middle {
    width: 550px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .circle-box {
      width: 50px;
      text-align: center;
      .circle {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background-color: #f4e983;
        margin: 0 auto;
      }
    }
    .line {
      width: 180px;
      height: 24px;
      background-color: #f4e983;
      border-radius: 10%;
    }
  }
  .end {
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .text {
      width: 80px;
      text-align: center;
    }
    .text1 {
      text-align: center;
    }
    .text3 {
      width: 70px;
      text-align: left;
    }
  }
}
</style>